Fix: Use /tmp for SQLite environments on Vercel serverless#1206
Merged
Fix: Use /tmp for SQLite environments on Vercel serverless#1206
Conversation
Fixes environment creation failure on Vercel deployment where POST succeeds but GET returns 404. **Root Cause:** - LocalSQLiteEnvironmentDatabaseAdapter was trying to write to `.objectstack/data/environments/` - Vercel serverless functions have read-only filesystem except for `/tmp` - Environment provisioning failed silently when trying to create database files - POST returned 202 Accepted, but async provisioning failed - Subsequent GET requests returned 404 because environment was stuck in "failed" state **Solution:** - Detect serverless environments (VERCEL=1, AWS_LAMBDA_FUNCTION_NAME, FUNCTION_NAME) - Use `/tmp/.objectstack/data/environments/` in serverless, `.objectstack/data/environments/` in local dev - Both `sqlite` and `turso` (fallback) adapters now use the serverless-aware path **Testing:** - Environment creation will now succeed on Vercel - Local development unaffected (still uses relative path) - AWS Lambda and similar platforms also supported 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: os-zhuang <277994282+os-zhuang@users.noreply.github.com>
Claude created this pull request from a session on behalf of
os-zhuang
April 21, 2026 14:34
View session
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Environment creation on Vercel was silently failing: POST returned 202 Accepted but subsequent GET returned 404. The provisioning process failed because SQLite adapters tried writing to read-only filesystem paths.
Changes
Serverless environment detection in
createDefaultEnvironmentAdapters():VERCEL=1,AWS_LAMBDA_FUNCTION_NAME, orFUNCTION_NAME/tmp/.objectstack/data/environments/in serverless contexts.objectstack/data/environments/for local developmentApplied to both adapters:
sqlitedriver (direct)tursodriver (fallback when no cloud credentials configured)Implementation
Note
Production deployments should use Turso cloud credentials (
TURSO_ORG_NAME+TURSO_API_TOKEN) for persistence. SQLite in/tmpis ephemeral across cold starts.